package edu.gmu.projects.fireresponder.xml.alerts;

import java.util.ArrayList;
import java.util.List;

import edu.gmu.projects.fireresponder.FirstResponder;

public class FirstResponderAlert extends Alert {

	private FirstResponder responder;
	
	private byte[] imageContents;
	private String imageMimeType;
	private List<Alert> embeddedAlerts;

	private String message;

	public List<Alert> getEmbeddedAlerts() {
		return embeddedAlerts;
	}

	protected void setEmbeddedAlerts(List<Alert> embeddedAlerts) {
		this.embeddedAlerts = embeddedAlerts;
	}

	protected void addEmbeddedAlerts(List<Alert> embeddedAlerts) {
		this.embeddedAlerts.addAll(embeddedAlerts);
	}

	protected void addEmbeddedAlerts(Alert embeddedAlert) {
		this.embeddedAlerts.add(embeddedAlert);
	}

	public FirstResponderAlert() {
		embeddedAlerts = new ArrayList<Alert>();
	}

	public FirstResponder getResponder() {
		return responder;
	}

	protected void setResponder(FirstResponder responder) {
		this.responder = responder;
	}

	public byte[] getImageContents() {
		return imageContents;
	}

	protected void setImageContents(byte[] imageContents) {
		this.imageContents = imageContents;
	}

	public String getImageMimeType() {
		return imageMimeType;
	}

	protected void setImageMimeType(String imageMimeType) {
		this.imageMimeType = imageMimeType;
	}

	public String getMessage() {
		return message;
	}

	protected void setMessage(String msg) {
		this.message = msg;
	}
	
	public String generateXmlMsg() {
		AlertGenerator alts = new AlertGenerator();
		return alts.generateResponderFireAlert(responder.toString(), 
				getTime(), getLocation().getLatitude(), getLocation().getLongitude(), 
				message, imageContents, imageMimeType);
	}
}
